<?xml version="1.0" encoding="windows-1255" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
   	        var xmlHttp;
            function showResults(searchForm){
                var category = searchForm.category.value;
                var user = searchForm.user.value;
                var title = searchForm.title.value;
                
                var params = "category=" + category + "&user=" + user + "&title=" + title;
                
                xmlHttp = new XMLHttpRequest();
        	    xmlHttp.open("GET", "search?" + params, false);
				xmlHttp.send(null);
               	xmlHttp.onreadystatechange = updateResDiv();               	
            }

			function updateResDiv(){
				var resDiv = document.getElementById("results");
				if (xmlHttp.readyState == 4){
       				resDiv.innerHTML = xmlHttp.responseText;
       			}
       			else{
       				resDiv.innerHTML = "<p>Loading...</p>";
       			}	
			}
        </script>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
        <title>Search page</title>
    </head>
    <body>
        <h2>Hello, please enter your search terms.</h2>
        <form action="">
	        <table>
		        <tr>
			        <td>Category:</td>
			        <td><input type="text" name="category" /></td>
		        </tr>
		        <tr>
			        <td>User:</td>
			        <td><input type="text" name="user" /></td>
		        </tr>
		        <tr>
			        <td>Words within title:</td>
			        <td><input type="text" name="title" /></td>
		        </tr>
		        <tr>
			        <td>Words within code:</td>
			        <td><input type="text" name="code" /></td>
		        </tr>
		        <tr>
			        <td>Language:</td>
			        <td><input type="text" name="language" /></td>
		        </tr>
		        <tr>
			        <td>Show all versions:</td>
			        <td><input type="checkbox" name="versions" />(Otherwise only last version will by shown)</td>
		        </tr>
	        </table>
	        <input type="button" value="search" onclick="showResults(this.form)" />
	        <input type="reset" value="clear form" />
        </form>
        <div id="results" />
    </body>
</html>